const { app, BrowserWindow, ipcMain, shell } = require('electron');
const child = require('child_process');
const fs = require('fs');

// shell.openExternal('https://github.com')
const createWindow = () => {
    const win = new BrowserWindow({
        width: 1440,
        height: 900,
        minWidth: 1440,
        minHeight: 900,
        maxWidth: 1920,
        maxHeight: 1080,
        frame: true,
        autoHideMenuBar: true,
        title: "win11",
        icon: "./assets/image/icon/computer.ico",
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false
        }
    })

    win.loadFile("index.html");
    // win.loadURL("http://127.0.0.1:5500/index.html");
    // win.webContents.openDevTools();
};

let winFlagDir = __dirname + '/assets/json/winFlag.json';
let winFlag = JSON.parse(fs.readFileSync(winFlagDir, { encoding: 'utf-8' }));
winFlag[0].open = false;
fs.writeFileSync(winFlagDir, JSON.stringify(winFlag));

app.whenReady().then(() => {
    createWindow()
})